//二维码生成工具类  生成二维码保存到本地
var http = require("../utils/http");
//微信登录校验
exports.wxAuth=function(code,callback){

  //先调用token
  getAccessToken(code,function(bool,data){

    //token获取成功 获取用户信息
    if(bool&&!data.errcode){
     // callback(data);
     var accessToken = data.access_token;
     var openId = data.openid;
     getUserInfo(accessToken,openId,callback);

    }else{
      console.log("调用微信失败 code = " +data.errcode  +"  errmsg = " + data.errmsg);
      callback(false,data.errmsg);
    }
   });
};